<template>
  <div class="c-eqpt-model-view-fault">
    <c-row-search>
      <c-row margin>
        <c-col>
          <el-input
            v-model="keyword"
            @keyup.enter.native="search"
            clearable
            :placeholder="tplLang('text_asset_a', ['btn_search_a'])"
          >
            <c-icon slot="prefix" name="search" prefix></c-icon>
          </el-input>
        </c-col>
        <c-col>
          <el-button type="primary" @click="search">
            {{ multLang('btn_search_a') }}
          </el-button>
        </c-col>
      </c-row>
    </c-row-search>

    <c-table :data="filterData" :col="table.col"></c-table>
  </div>
</template>
<script>
import { searchWord } from '@/util/data'
export default {
  name: 'CEqptModelViewFault',
  components: {},
  props: {
    data: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data() {
    return {
      keyword: '',
      filterData: [],
      table: {
        col: [
          { label: 'title_error_a', prop: 'repair_code' },
          { label: 'title_comp_a', prop: 'finished_time' },
          { label: 'title_b', prop: 'work_code' }
        ]
      }
    }
  },
  computed: {},
  watch: {
    data: {
      deep: true,
      handler() {
        this.search()
      }
    }
  },
  beforeCreate() {},
  created() {},
  beforeMount() {},
  mounted() {},
  beforeUpdate() {},
  updated() {},
  activated() {},
  deactivated() {},
  beforeDestroy() {},
  destroyed() {},
  methods: {
    search() {
      this.filterData = searchWord(this.keyword, this.data, 'repair_code')
    }
  }
}
</script>
<style lang="scss">
.c-eqpt-model-view-fault {
  @include wh;
}
</style>
